<?php
/**
 * This creates a text file called es_GlobalBan_Reason_db.txt which the sever admin
 * must place in eventscripts/GlobalBan whenever they add or remove ban reasons. 
 * This is the ONLY file that does not use index.php as a reference 
 */ 

define("ROOTDIR", dirname(__FILE__)); // Global Constant of root directory

require_once(ROOTDIR."/include/database/class.Database.php"); //Database class
require_once(ROOTDIR."/include/database/class.ReasonQueries.php"); //Database class
 
header('Content-Type: text');
header('Content-Disposition: attachment; filename="es_GlobalBan_Reason_db.txt"');

$db = new Database(); // Create a new database object
$reasonQueries = new ReasonQueries();

$reasons = $reasonQueries->getReasonList();

?>
GlobalBan_Reason
{
<?php

for($i=0; $i<count($reasons); $i++) { 
    $reason = $reasons[$i];
?>   "<?=$reason->getId()?>"
   {
    "reasonId"       "<?=$reason->getId()?>"
	  "reasonText"     "<?=$reason->getReason()?>"
   }
<?php
}
?>
}
